package demo.util;

import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;


public class Html2Text {
	
	private static Pattern pattern_lt;
	private static Matcher matcher_lt;
	private static Pattern pattern_gt;
	private static Matcher matcher_gt;
	private final static String regex_lt = "<";
	private final static String regex_gt = ">";
	
	public static String getText(String rawString) {
		try {
			pattern_lt = Pattern.compile(regex_lt, Pattern.CASE_INSENSITIVE);
			matcher_lt = pattern_lt.matcher(rawString);
			rawString = matcher_lt.replaceAll("&lt;"); //	替换<标签
			pattern_gt = Pattern.compile(regex_gt, Pattern.CASE_INSENSITIVE);
			matcher_gt = pattern_gt.matcher(rawString);
			rawString = matcher_gt.replaceAll("&gt;"); //	替换>标签

		} catch (Exception e) {
			e.printStackTrace();
		}
		return rawString;
	}
	
	public static void main(String[] args) {
		//"<img src=\"${ctx }/avatar/${sessionScope.user.avatar }\" width=\"50\" />${sessionScope.user.nick }";
		String string = (new Scanner(System.in)).nextLine();
		System.out.println(getText(string));
		
	}
}
